home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Magazine Collection 2001
/
Delphi Magazine Collection 20001 (2001).iso
/
DISKS
/
Issue45
/
Clinic
/
Server_Stub2.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
2000-11-02
|
2KB
|
60 lines
unit Server_Stub2;
interface
uses
CorbaObj, OrbPas;
type
ITest = interface
['{6B0BEBC1-40B4-11D2-8684-0020182CD6A0}']
function Get_DateAndTime: TDateTime;
end;
TTestStub = class(TCorbaStub, ITest)
function Get_DateAndTime: TDateTime;
end;
ITestFactory = interface
['{2270CD21-D63E-11D2-96EC-0060978E1359}']
function CreateInstance(const InstanceName: String): ITest;
end;
TTestFactoryStub = class(TCorbaStub, ITestFactory)
function CreateInstance(const InstanceName: String): ITest;
end;
implementation
{ TTestStub }
function TTestStub.Get_DateAndTime: TDateTime;
var
OutBuf: IMarshalOutBuffer;
InBuf: IMarshalInBuffer;
begin;
FStub.CreateRequest('Get_DateAndTime', True, OutBuf);
FStub.Invoke(OutBuf, InBuf);
Result := InBuf.GetDouble;
end;
{ TTestFactoryStub }
function TTestFactoryStub.CreateInstance(const InstanceName: String): ITest;
var
OutBuf: IMarshalOutBuffer;
InBuf: IMarshalInBuffer;
begin;
FStub.CreateRequest('CreateInstance', True, OutBuf);
OutBuf.PutText(PChar(InstanceName));
FStub.Invoke(OutBuf, InBuf);
Result := UnmarshalObject(InBuf, ITest) as ITest;
end;
initialization
CorbaStubManager.RegisterStub(ITest, TTestStub);
CorbaInterfaceIDManager.RegisterInterface(ITest, 'IDL:Server/Test:1.0');
CorbaStubManager.RegisterStub(ITestFactory, TTestFactoryStub);
CorbaInterfaceIDManager.RegisterInterface(ITestFactory, 'IDL:Server/TestFactory:1.0');
end.